{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6295d880-ef7c-4afa-abe0-1fdf214d484e",
   "metadata": {},
   "source": [
    "# 数据清洗"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 269,
   "id": "700d2f17-18f3-469b-8e8d-e04a5173e9cb",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 287,
   "id": "94416f6b-6bb7-4f75-8d22-e6fcc53640f4",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv(r\"./out/data.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 289,
   "id": "c30c5aba-a315-4bd7-bd2b-54fb8a9280be",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Key Developments By Date</th>\n",
       "      <th>Key Developments by Type</th>\n",
       "      <th>Company Name(s)</th>\n",
       "      <th>Key Development Headline</th>\n",
       "      <th>Key Development Situation</th>\n",
       "      <th>Key Development Sources</th>\n",
       "      <th>Geographic Locations</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "      <td>GlobeNewswire – Canada</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "      <td>Canada News Wire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "      <td>PR Newswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "      <td>Transcript Collection</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "      <td>GlobeNewswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2022-12-02</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Natural Grocers by Vitamin Cottage, Inc. (NYSE...</td>\n",
       "      <td>Natural Grocers Hiring Select Positions for Ne...</td>\n",
       "      <td>Natural Grocers is currently seeking additiona...</td>\n",
       "      <td>PR Newswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2022-12-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Southern Empire Resources Corp. (TSXV:SMP)</td>\n",
       "      <td>Southern Empire Resources Corp. Expands Its Mi...</td>\n",
       "      <td>Southern Empire Resources Corp. announces that...</td>\n",
       "      <td>Other</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2022-08-15</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Nate's Food Co. (OTCPK:NHMD)</td>\n",
       "      <td>Nate’s Food Co. Expands Bitcoin Mining Operati...</td>\n",
       "      <td>Nate’s Food Co. announced that it has purchase...</td>\n",
       "      <td>GlobeNewswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2023-06-15</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Rayonier Advanced Materials Inc. (NYSE:RYAM)</td>\n",
       "      <td>Rayonier Advanced Materials Inc. Announces the...</td>\n",
       "      <td>Rayonier Advanced Materials Inc. hosted a cere...</td>\n",
       "      <td>Business Wire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2022-05-10</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Emerald Holding, Inc. (NYSE:EEX)</td>\n",
       "      <td>Emerald Holding, Inc. Announces New Division D...</td>\n",
       "      <td>Emerald Holding, Inc. announced the creation o...</td>\n",
       "      <td>Business Wire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2021-03-24</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Clean Seed Capital Group Ltd. (TSXV:CSX)</td>\n",
       "      <td>Clean Seed Capital Group Ltd. to Break Ground ...</td>\n",
       "      <td>Clean Seed Capital Group Ltd. announces the Co...</td>\n",
       "      <td>SEDAR</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2023-12-01</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Kermode Resources Ltd. (TSXV:KLM)</td>\n",
       "      <td>Kermode Resources Ltd. Receives Work Permit fo...</td>\n",
       "      <td>Kermode Resources Ltd. announced the receipt o...</td>\n",
       "      <td>SEDAR</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2021-07-29</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Rogers Communications Inc. (TSX:RCI.B)</td>\n",
       "      <td>Rogers Communications Continues Canada’s 5G Ne...</td>\n",
       "      <td>Rogers Communications announced that it invest...</td>\n",
       "      <td>GlobeNewswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2022-08-10</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Toll Brothers, Inc. (NYSE:TOL)</td>\n",
       "      <td>Toll Brothers Announces Model Homes Now Open a...</td>\n",
       "      <td>Toll Brothers, Inc. announced the opening of 1...</td>\n",
       "      <td>GlobeNewswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>2021-11-16</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>The Wendy's Company (NasdaqGS:WEN)</td>\n",
       "      <td>The Wendy's Company's Opens 1,000th Internatio...</td>\n",
       "      <td>The Wendy's Company announced the opening of i...</td>\n",
       "      <td>PR Newswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>2021-04-07</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Curaleaf Holdings, Inc. (TSX:CURA)</td>\n",
       "      <td>Curaleaf Holdings, Inc. Establishes Curaleaf I...</td>\n",
       "      <td>Curaleaf Holdings, Inc. has simultaneously est...</td>\n",
       "      <td>Canada News Wire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2022-03-28</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Delta Apparel, Inc. (NYSEAM:DLA)</td>\n",
       "      <td>Delta Apparel, Inc. Launches New ‘On-Demand’ D...</td>\n",
       "      <td>Delta Apparel, Inc. announced the expansion of...</td>\n",
       "      <td>Business Wire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2021-05-21</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>KB Home (NYSE:KBH)</td>\n",
       "      <td>KB Home Announces the Grand Opening of Fishers...</td>\n",
       "      <td>KB Home announced the grand opening of Fishers...</td>\n",
       "      <td>Business Wire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>2023-05-31</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>PureCycle Technologies, Inc. (NasdaqCM:PCT)</td>\n",
       "      <td>PureCycle Technologies, Inc. Finalizes Financi...</td>\n",
       "      <td>PureCycle Technologies, Inc. announced that it...</td>\n",
       "      <td>Other</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>2023-07-17</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Verizon Communications Inc. (NYSE:VZ)</td>\n",
       "      <td>Verizon Continues to Upgrade Daytona's Best Ne...</td>\n",
       "      <td>Verizon has recently made major upgrades to th...</td>\n",
       "      <td>GlobeNewswire</td>\n",
       "      <td>United States and Canada (Primary)</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Key Developments By Date Key Developments by Type  \\\n",
       "0                2022-07-26      Business Expansions   \n",
       "1                2021-04-12      Business Expansions   \n",
       "2                2021-10-18      Business Expansions   \n",
       "3                2023-05-09      Business Expansions   \n",
       "4                2021-12-22      Business Expansions   \n",
       "5                2022-12-02      Business Expansions   \n",
       "6                2022-12-12      Business Expansions   \n",
       "7                2022-08-15      Business Expansions   \n",
       "8                2023-06-15      Business Expansions   \n",
       "9                2022-05-10      Business Expansions   \n",
       "10               2021-03-24      Business Expansions   \n",
       "11               2023-12-01      Business Expansions   \n",
       "12               2021-07-29      Business Expansions   \n",
       "13               2022-08-10      Business Expansions   \n",
       "14               2021-11-16      Business Expansions   \n",
       "15               2021-04-07      Business Expansions   \n",
       "16               2022-03-28      Business Expansions   \n",
       "17               2021-05-21      Business Expansions   \n",
       "18               2023-05-31      Business Expansions   \n",
       "19               2023-07-17      Business Expansions   \n",
       "\n",
       "                                      Company Name(s)  \\\n",
       "0          Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1   International Business Machines Corporation (N...   \n",
       "2             Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3         Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4                Generation Mining Limited (TSX:GENM)   \n",
       "5   Natural Grocers by Vitamin Cottage, Inc. (NYSE...   \n",
       "6          Southern Empire Resources Corp. (TSXV:SMP)   \n",
       "7                        Nate's Food Co. (OTCPK:NHMD)   \n",
       "8        Rayonier Advanced Materials Inc. (NYSE:RYAM)   \n",
       "9                    Emerald Holding, Inc. (NYSE:EEX)   \n",
       "10           Clean Seed Capital Group Ltd. (TSXV:CSX)   \n",
       "11                  Kermode Resources Ltd. (TSXV:KLM)   \n",
       "12             Rogers Communications Inc. (TSX:RCI.B)   \n",
       "13                     Toll Brothers, Inc. (NYSE:TOL)   \n",
       "14                 The Wendy's Company (NasdaqGS:WEN)   \n",
       "15                 Curaleaf Holdings, Inc. (TSX:CURA)   \n",
       "16                   Delta Apparel, Inc. (NYSEAM:DLA)   \n",
       "17                                 KB Home (NYSE:KBH)   \n",
       "18        PureCycle Technologies, Inc. (NasdaqCM:PCT)   \n",
       "19              Verizon Communications Inc. (NYSE:VZ)   \n",
       "\n",
       "                             Key Development Headline  \\\n",
       "0   Wallbridge Mining Company Limited Reports Sign...   \n",
       "1      IBM Announces Kyndryl, New Independent Company   \n",
       "2   Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3   Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4   Generation Mining Limited Agrees to Enter into...   \n",
       "5   Natural Grocers Hiring Select Positions for Ne...   \n",
       "6   Southern Empire Resources Corp. Expands Its Mi...   \n",
       "7   Nate’s Food Co. Expands Bitcoin Mining Operati...   \n",
       "8   Rayonier Advanced Materials Inc. Announces the...   \n",
       "9   Emerald Holding, Inc. Announces New Division D...   \n",
       "10  Clean Seed Capital Group Ltd. to Break Ground ...   \n",
       "11  Kermode Resources Ltd. Receives Work Permit fo...   \n",
       "12  Rogers Communications Continues Canada’s 5G Ne...   \n",
       "13  Toll Brothers Announces Model Homes Now Open a...   \n",
       "14  The Wendy's Company's Opens 1,000th Internatio...   \n",
       "15  Curaleaf Holdings, Inc. Establishes Curaleaf I...   \n",
       "16  Delta Apparel, Inc. Launches New ‘On-Demand’ D...   \n",
       "17  KB Home Announces the Grand Opening of Fishers...   \n",
       "18  PureCycle Technologies, Inc. Finalizes Financi...   \n",
       "19  Verizon Continues to Upgrade Daytona's Best Ne...   \n",
       "\n",
       "                            Key Development Situation Key Development Sources  \\\n",
       "0   Wallbridge Mining Company Limited reported pos...  GlobeNewswire – Canada   \n",
       "1   IBM announced that Kyndryl will be the name of...        Canada News Wire   \n",
       "2   Lazydays, The RV Authority, announced that it ...             PR Newswire   \n",
       "3   Good Times Restaurants Inc. announced that it ...   Transcript Collection   \n",
       "4   Generation Mining Limited announced that it ha...           GlobeNewswire   \n",
       "5   Natural Grocers is currently seeking additiona...             PR Newswire   \n",
       "6   Southern Empire Resources Corp. announces that...                   Other   \n",
       "7   Nate’s Food Co. announced that it has purchase...           GlobeNewswire   \n",
       "8   Rayonier Advanced Materials Inc. hosted a cere...           Business Wire   \n",
       "9   Emerald Holding, Inc. announced the creation o...           Business Wire   \n",
       "10  Clean Seed Capital Group Ltd. announces the Co...                   SEDAR   \n",
       "11  Kermode Resources Ltd. announced the receipt o...                   SEDAR   \n",
       "12  Rogers Communications announced that it invest...           GlobeNewswire   \n",
       "13  Toll Brothers, Inc. announced the opening of 1...           GlobeNewswire   \n",
       "14  The Wendy's Company announced the opening of i...             PR Newswire   \n",
       "15  Curaleaf Holdings, Inc. has simultaneously est...        Canada News Wire   \n",
       "16  Delta Apparel, Inc. announced the expansion of...           Business Wire   \n",
       "17  KB Home announced the grand opening of Fishers...           Business Wire   \n",
       "18  PureCycle Technologies, Inc. announced that it...                   Other   \n",
       "19  Verizon has recently made major upgrades to th...           GlobeNewswire   \n",
       "\n",
       "                  Geographic Locations  \n",
       "0   United States and Canada (Primary)  \n",
       "1   United States and Canada (Primary)  \n",
       "2   United States and Canada (Primary)  \n",
       "3   United States and Canada (Primary)  \n",
       "4   United States and Canada (Primary)  \n",
       "5   United States and Canada (Primary)  \n",
       "6   United States and Canada (Primary)  \n",
       "7   United States and Canada (Primary)  \n",
       "8   United States and Canada (Primary)  \n",
       "9   United States and Canada (Primary)  \n",
       "10  United States and Canada (Primary)  \n",
       "11  United States and Canada (Primary)  \n",
       "12  United States and Canada (Primary)  \n",
       "13  United States and Canada (Primary)  \n",
       "14  United States and Canada (Primary)  \n",
       "15  United States and Canada (Primary)  \n",
       "16  United States and Canada (Primary)  \n",
       "17  United States and Canada (Primary)  \n",
       "18  United States and Canada (Primary)  \n",
       "19  United States and Canada (Primary)  "
      ]
     },
     "execution_count": 289,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 291,
   "id": "ae6585de-fe04-4beb-bfc2-0baa97973f28",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# 数据多了 裁剪一点出来演示\n",
    "df = df.iloc[:5,:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 293,
   "id": "b8017480-2850-438e-9eab-af708108a72a",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Key Developments By Date</th>\n",
       "      <th>Key Developments by Type</th>\n",
       "      <th>Company Name(s)</th>\n",
       "      <th>Key Development Headline</th>\n",
       "      <th>Key Development Situation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Key Developments By Date Key Developments by Type  \\\n",
       "0               2022-07-26      Business Expansions   \n",
       "1               2021-04-12      Business Expansions   \n",
       "2               2021-10-18      Business Expansions   \n",
       "3               2023-05-09      Business Expansions   \n",
       "4               2021-12-22      Business Expansions   \n",
       "\n",
       "                                     Company Name(s)  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                            Key Development Headline  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                           Key Development Situation  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 293,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 297,
   "id": "106ad543-473c-48be-a1e3-5f246a4592d0",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df.columns = ['a', 'b',\"c\",\"d\",\"e\"]      # 重命名列名   列表和df的列要对应"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 299,
   "id": "e8ecb56c-b983-413b-8b9e-12719cf9a642",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3  2023-05-09  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 299,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "a89729ea-993d-4158-9be8-adabc0c8d0b4",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "Length mismatch: Expected axis has 2 elements, new values have 3 elements",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[32], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m df\u001b[38;5;241m.\u001b[39mcolumns \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mc\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n",
      "File \u001b[1;32m~\\anaconda3\\Lib\\site-packages\\pandas\\core\\generic.py:6218\u001b[0m, in \u001b[0;36mNDFrame.__setattr__\u001b[1;34m(self, name, value)\u001b[0m\n\u001b[0;32m   6216\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m   6217\u001b[0m     \u001b[38;5;28mobject\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__getattribute__\u001b[39m(\u001b[38;5;28mself\u001b[39m, name)\n\u001b[1;32m-> 6218\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mobject\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__setattr__\u001b[39m(\u001b[38;5;28mself\u001b[39m, name, value)\n\u001b[0;32m   6219\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mAttributeError\u001b[39;00m:\n\u001b[0;32m   6220\u001b[0m     \u001b[38;5;28;01mpass\u001b[39;00m\n",
      "File \u001b[1;32mproperties.pyx:69\u001b[0m, in \u001b[0;36mpandas._libs.properties.AxisProperty.__set__\u001b[1;34m()\u001b[0m\n",
      "File \u001b[1;32m~\\anaconda3\\Lib\\site-packages\\pandas\\core\\generic.py:767\u001b[0m, in \u001b[0;36mNDFrame._set_axis\u001b[1;34m(self, axis, labels)\u001b[0m\n\u001b[0;32m    762\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    763\u001b[0m \u001b[38;5;124;03mThis is called from the cython code when we set the `index` attribute\u001b[39;00m\n\u001b[0;32m    764\u001b[0m \u001b[38;5;124;03mdirectly, e.g. `series.index = [1, 2, 3]`.\u001b[39;00m\n\u001b[0;32m    765\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m    766\u001b[0m labels \u001b[38;5;241m=\u001b[39m ensure_index(labels)\n\u001b[1;32m--> 767\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_mgr\u001b[38;5;241m.\u001b[39mset_axis(axis, labels)\n\u001b[0;32m    768\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_clear_item_cache()\n",
      "File \u001b[1;32m~\\anaconda3\\Lib\\site-packages\\pandas\\core\\internals\\managers.py:227\u001b[0m, in \u001b[0;36mBaseBlockManager.set_axis\u001b[1;34m(self, axis, new_labels)\u001b[0m\n\u001b[0;32m    225\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mset_axis\u001b[39m(\u001b[38;5;28mself\u001b[39m, axis: AxisInt, new_labels: Index) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m    226\u001b[0m     \u001b[38;5;66;03m# Caller is responsible for ensuring we have an Index object.\u001b[39;00m\n\u001b[1;32m--> 227\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_validate_set_axis(axis, new_labels)\n\u001b[0;32m    228\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maxes[axis] \u001b[38;5;241m=\u001b[39m new_labels\n",
      "File \u001b[1;32m~\\anaconda3\\Lib\\site-packages\\pandas\\core\\internals\\base.py:85\u001b[0m, in \u001b[0;36mDataManager._validate_set_axis\u001b[1;34m(self, axis, new_labels)\u001b[0m\n\u001b[0;32m     82\u001b[0m     \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[0;32m     84\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m new_len \u001b[38;5;241m!=\u001b[39m old_len:\n\u001b[1;32m---> 85\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[0;32m     86\u001b[0m         \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLength mismatch: Expected axis has \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mold_len\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m elements, new \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     87\u001b[0m         \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvalues have \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnew_len\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m elements\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m     88\u001b[0m     )\n",
      "\u001b[1;31mValueError\u001b[0m: Length mismatch: Expected axis has 2 elements, new values have 3 elements"
     ]
    }
   ],
   "source": [
    "df.columns = ['a', 'b',\"c\"]      # 重命名列名   列表和df的列要对应"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5b167254-54fe-4d1c-8caf-7efed8f3b45b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 301,
   "id": "11a12ae3-5069-4c74-ae8e-eef069f49055",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3  2023-05-09  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 301,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.rename(columns={'a': 'new_a'})  # 选择性更改列名     可以看到结果的 没有保存结果   可以加上 inplace=True  或者 直接加上 df = 在前面"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 303,
   "id": "d8258717-2f15-4c42-af3f-73725cc551c4",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3  2023-05-09  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 303,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 305,
   "id": "9af9f521-d421-44b2-af2c-aef01dee2ce5",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df.rename(columns={'a': 'new_a'},inplace=True)   # 这个字典可以多 匹配上就换 没匹配就没动"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 307,
   "id": "1d29d94e-f80b-4d62-8d3d-0ca0587d30ad",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3  2023-05-09  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 307,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 309,
   "id": "34c55885-8d84-444e-be23-e1eb3af68a18",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=5, step=1)"
      ]
     },
     "execution_count": 309,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.index  # 查看当前索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 311,
   "id": "63d3c97a-2ce4-48f7-96c7-3f614c859a22",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>new_a</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2022-07-26</th>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-04-12</th>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-10-18</th>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-05-09</th>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-22</th>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              b  \\\n",
       "new_a                             \n",
       "2022-07-26  Business Expansions   \n",
       "2021-04-12  Business Expansions   \n",
       "2021-10-18  Business Expansions   \n",
       "2023-05-09  Business Expansions   \n",
       "2021-12-22  Business Expansions   \n",
       "\n",
       "                                                            c  \\\n",
       "new_a                                                           \n",
       "2022-07-26         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "2021-04-12  International Business Machines Corporation (N...   \n",
       "2021-10-18            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "2023-05-09        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "2021-12-22               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                            d  \\\n",
       "new_a                                                           \n",
       "2022-07-26  Wallbridge Mining Company Limited Reports Sign...   \n",
       "2021-04-12     IBM Announces Kyndryl, New Independent Company   \n",
       "2021-10-18  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "2023-05-09  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "2021-12-22  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                            e  \n",
       "new_a                                                          \n",
       "2022-07-26  Wallbridge Mining Company Limited reported pos...  \n",
       "2021-04-12  IBM announced that Kyndryl will be the name of...  \n",
       "2021-10-18  Lazydays, The RV Authority, announced that it ...  \n",
       "2023-05-09  Good Times Restaurants Inc. announced that it ...  \n",
       "2021-12-22  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 311,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.set_index(\"new_a\")  # 更改某列为索引列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 315,
   "id": "7ecda1a7-be16-4e82-9a05-f9c740862d57",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "1  2022-07-26  Business Expansions   \n",
       "2  2021-04-12  Business Expansions   \n",
       "3  2021-10-18  Business Expansions   \n",
       "4  2023-05-09  Business Expansions   \n",
       "5  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "1         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "2  International Business Machines Corporation (N...   \n",
       "3            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "4        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "5               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "1  Wallbridge Mining Company Limited Reports Sign...   \n",
       "2     IBM Announces Kyndryl, New Independent Company   \n",
       "3  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "4  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "5  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "1  Wallbridge Mining Company Limited reported pos...  \n",
       "2  IBM announced that Kyndryl will be the name of...  \n",
       "3  Lazydays, The RV Authority, announced that it ...  \n",
       "4  Good Times Restaurants Inc. announced that it ...  \n",
       "5  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 315,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.rename(index=lambda x: x + 1)  # 批量重命名索引      修改的是索引的值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 317,
   "id": "546f2b81-e80c-4771-ab78-ba7cb3c140be",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['new_a', 'b', 'c', 'd', 'e'], dtype='object')"
      ]
     },
     "execution_count": 317,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns  # 查看你当前列名"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 319,
   "id": "9a08b997-a305-4bf2-a5dd-ad192aa57030",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a_1</th>\n",
       "      <th>b_1</th>\n",
       "      <th>c_1</th>\n",
       "      <th>d_1</th>\n",
       "      <th>e_1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-05-09</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      new_a_1                  b_1  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3  2023-05-09  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                 c_1  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                 d_1  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                 e_1  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 319,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.rename(columns=lambda x: x + \"_1\")  # 批量更改列名   修改的是列名的值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 321,
   "id": "bcb5e614-dee4-4c06-a726-9d2bc0c1505b",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   new_a      b      c      d      e\n",
       "0  False  False  False  False  False\n",
       "1  False  False  False  False  False\n",
       "2  False  False  False  False  False\n",
       "3  False  False  False  False  False\n",
       "4  False  False  False  False  False"
      ]
     },
     "execution_count": 321,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.isnull()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 323,
   "id": "eee21487-b3a3-4f8f-a36f-b6f8345250a6",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df.loc[3,'new_a'] = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 325,
   "id": "cbd28834-071b-4334-9bf7-3dd6fb595385",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df.loc[1,'b'] = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 327,
   "id": "03e8bb25-5853-425b-9659-9f803b45c8b0",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   new_a      b      c      d      e\n",
       "0  False  False  False  False  False\n",
       "1  False   True  False  False  False\n",
       "2  False  False  False  False  False\n",
       "3   True  False  False  False  False\n",
       "4  False  False  False  False  False"
      ]
     },
     "execution_count": 327,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.isnull()  # 检查DataFrame对象中的空值，并返回一个Boolean数组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 329,
   "id": "94c7711d-627f-480a-9c01-c73cbbc0012f",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   new_a      b     c     d     e\n",
       "0   True   True  True  True  True\n",
       "1   True  False  True  True  True\n",
       "2   True   True  True  True  True\n",
       "3  False   True  True  True  True\n",
       "4   True   True  True  True  True"
      ]
     },
     "execution_count": 329,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.notnull()  # 检查DataFrame对象中的非空值，并返回一个Boolean数组"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a2b07e40-2344-482f-846d-694c19256ae1",
   "metadata": {},
   "source": [
    "## dropna   删除缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 331,
   "id": "48840fb2-6dab-4fe9-b266-1de498d45ac9",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                            c  \\\n",
       "0  Wallbridge Mining Company Limited (TSX:WM)   \n",
       "2     Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "4        Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 331,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna()  \n",
    "# 删除所有包含空值的行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 393,
   "id": "e72a5e65-5454-4c1c-8a0b-cd90dd8127c2",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-10-18  Business Expansions   \n",
       "2  2021-12-22  Business Expansions   \n",
       "\n",
       "                                            c  \\\n",
       "0  Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1     Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "2        Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "2  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  Lazydays, The RV Authority, announced that it ...  \n",
       "2  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 393,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna().reset_index(drop=True)  # drop 是否删掉原来的索引  否则会变为列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 395,
   "id": "e1f036d0-ffae-4d48-8bd8-c5c39e5cd840",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4</td>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   index       new_a                    b  \\\n",
       "0      0  2022-07-26  Business Expansions   \n",
       "1      2  2021-10-18  Business Expansions   \n",
       "2      4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                            c  \\\n",
       "0  Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1     Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "2        Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "2  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  Lazydays, The RV Authority, announced that it ...  \n",
       "2  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 395,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna().reset_index()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b53696f4-e367-4451-86f7-8f4718f6a6d7",
   "metadata": {},
   "source": [
    "### axis  方向设置"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 333,
   "id": "3241ba44-dcba-4eee-b2a2-0bfc9dc80c3c",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 333,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna(axis=1)    # axis 还可以使用 columns 和 index 作为参数\n",
    "# 删除所有包含空值的列   axios 空值方向的   =0 为行  =1 为列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 341,
   "id": "ed9429cf-ca24-4534-adcd-96ae2b567014",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>None</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>None</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12                 None   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3        None  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 341,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ecf6c90a-e7f0-4d8d-ac93-00ac83b789af",
   "metadata": {},
   "source": [
    "### 保留非空值为n的 行、列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 339,
   "id": "65b6ef9e-23fd-45ed-b4d6-5d35d0eaa835",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 339,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna(axis=1, thresh=5)  \n",
    "# 删除所有小于n个非空值的列        a 中间只要要求有5个值非空  a中只有4个 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 352,
   "id": "99415760-7bd1-4d69-829b-b1396ffe409f",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df.loc[3,\"b\"] = None  # 制造缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 354,
   "id": "60d24691-6420-43ee-af21-7f723a9ee301",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>None</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12                 None   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3        None                 None   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 354,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 356,
   "id": "aaf1c84e-393d-4be5-963d-5923d370bc3f",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "new_a    1\n",
       "b        2\n",
       "c        0\n",
       "d        0\n",
       "e        0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 356,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 358,
   "id": "bf101a1e-df2f-4ec7-8c96-e7f4d155d0de",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>None</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                                                  c  \\\n",
       "0  2022-07-26         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  2021-04-12  International Business Machines Corporation (N...   \n",
       "2  2021-10-18            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        None        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4  2021-12-22               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 358,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna(axis=1, thresh=4)   # thresh 的值要大于你想保留有值的个数加一"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 360,
   "id": "bacc67be-059d-479b-81cd-e29b33b4988f",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>None</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12                 None   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3        None                 None   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 360,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna(axis=0, thresh=1)  # 删除所有小于n个非空值的行"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "824f47b6-98f3-4218-b7e5-fc6794162618",
   "metadata": {},
   "source": [
    "### subset 去指定列中查看缺失值是否删除"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 386,
   "id": "faf119aa-e4d7-427f-9a9c-4c5daeaacc76",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>None</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12                 None   \n",
       "2  2021-10-18  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 386,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dropna(subset=['new_a', 'c'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cff709f6-7031-4023-821a-3570e96a7320",
   "metadata": {},
   "source": [
    "### how    \n",
    "{'any', 'all'}   默认 any    至少一个 NA 或所有 NA\\\n",
    "'any' ：如果存在任何 NA 值，请删除该行或列\\\n",
    "'all' ：如果所有值都是 NA，则删除该行或该列。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c2d508ba-850d-4404-bada-f9db534c5918",
   "metadata": {},
   "source": [
    "### inplace\n",
    "True False  覆盖或者不覆盖"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "839008ea-edf3-471f-bb86-4dfc82cb03cf",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "46659275-e03d-492c-88ca-430b58df6edf",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "50d47dfd-a631-4064-a8dd-475ec86846df",
   "metadata": {},
   "source": [
    "## 缺失值 填充"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "41532f23-1f63-4b72-8c44-ce11c3c55dd3",
   "metadata": {},
   "source": [
    "fillna() \n",
    "\n",
    "-   fillna(value=None, method=None, axis=None, inplace=False,limit=None, downcast=None, **kwargs)\n",
    "\n",
    "    -   value 替换缺失值的元素\n",
    "\n",
    "    -   method 填充方式  \n",
    "\n",
    "        -   取值为backfill或bfill时，表示使用下一个非缺失值来填补；\n",
    "\n",
    "        -   取值为pad或ffill时，表示使用上一个非缺失值来填补。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 366,
   "id": "a2918210-5e38-4054-8b04-4e0d27ce65d1",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>填充的值</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>填充的值</td>\n",
       "      <td>填充的值</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12                 填充的值   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3        填充的值                 填充的值   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 366,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.fillna(\"填充的值\")  # 用x替换DataFrame对象中所有的空值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 398,
   "id": "8f723128-228c-47d5-8e8c-76f0e7175216",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\666\\AppData\\Local\\Temp\\ipykernel_33156\\3516189083.py:1: FutureWarning: DataFrame.fillna with 'method' is deprecated and will raise in a future version. Use obj.ffill() or obj.bfill() instead.\n",
      "  df.fillna(method='backfill')\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3  2021-12-22  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 398,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.fillna(method='backfill')  # 下一个填充"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 401,
   "id": "b03a43de-3646-4db0-a68c-44fd48bae423",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\666\\AppData\\Local\\Temp\\ipykernel_33156\\3524271710.py:1: FutureWarning: DataFrame.fillna with 'method' is deprecated and will raise in a future version. Use obj.ffill() or obj.bfill() instead.\n",
      "  df.fillna(method='ffill')\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12  Business Expansions   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3  2021-10-18  Business Expansions   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 401,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.fillna(method='ffill')  # 上一个填充  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 409,
   "id": "8428ae27-fccc-4794-80ef-3edfd2cab058",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>new_a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "      <th>d</th>\n",
       "      <th>e</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022-07-26</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Wallbridge Mining Company Limited (TSX:WM)</td>\n",
       "      <td>Wallbridge Mining Company Limited Reports Sign...</td>\n",
       "      <td>Wallbridge Mining Company Limited reported pos...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-04-12</td>\n",
       "      <td>b</td>\n",
       "      <td>International Business Machines Corporation (N...</td>\n",
       "      <td>IBM Announces Kyndryl, New Independent Company</td>\n",
       "      <td>IBM announced that Kyndryl will be the name of...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-10-18</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Lazydays Holdings, Inc. (NasdaqCM:GORV)</td>\n",
       "      <td>Lazydays RV Announces Plans to Open Omaha Deal...</td>\n",
       "      <td>Lazydays, The RV Authority, announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>a</td>\n",
       "      <td>b</td>\n",
       "      <td>Good Times Restaurants Inc. (NasdaqCM:GTIM)</td>\n",
       "      <td>Good Times Restaurants Inc. Plans to Open New ...</td>\n",
       "      <td>Good Times Restaurants Inc. announced that it ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-12-22</td>\n",
       "      <td>Business Expansions</td>\n",
       "      <td>Generation Mining Limited (TSX:GENM)</td>\n",
       "      <td>Generation Mining Limited Agrees to Enter into...</td>\n",
       "      <td>Generation Mining Limited announced that it ha...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        new_a                    b  \\\n",
       "0  2022-07-26  Business Expansions   \n",
       "1  2021-04-12                    b   \n",
       "2  2021-10-18  Business Expansions   \n",
       "3           a                    b   \n",
       "4  2021-12-22  Business Expansions   \n",
       "\n",
       "                                                   c  \\\n",
       "0         Wallbridge Mining Company Limited (TSX:WM)   \n",
       "1  International Business Machines Corporation (N...   \n",
       "2            Lazydays Holdings, Inc. (NasdaqCM:GORV)   \n",
       "3        Good Times Restaurants Inc. (NasdaqCM:GTIM)   \n",
       "4               Generation Mining Limited (TSX:GENM)   \n",
       "\n",
       "                                                   d  \\\n",
       "0  Wallbridge Mining Company Limited Reports Sign...   \n",
       "1     IBM Announces Kyndryl, New Independent Company   \n",
       "2  Lazydays RV Announces Plans to Open Omaha Deal...   \n",
       "3  Good Times Restaurants Inc. Plans to Open New ...   \n",
       "4  Generation Mining Limited Agrees to Enter into...   \n",
       "\n",
       "                                                   e  \n",
       "0  Wallbridge Mining Company Limited reported pos...  \n",
       "1  IBM announced that Kyndryl will be the name of...  \n",
       "2  Lazydays, The RV Authority, announced that it ...  \n",
       "3  Good Times Restaurants Inc. announced that it ...  \n",
       "4  Generation Mining Limited announced that it ha...  "
      ]
     },
     "execution_count": 409,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.fillna(value={'b': 'b', 'new_a': 'a'})   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "77ad9b85-7f44-441f-922e-85f0eb629254",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dd77a7c5-bcce-4d86-a5d5-238b0729c2b4",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "90407e3d-42d4-44d7-a09e-ecc2aced40d0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "249921c3-b323-4110-8910-bf83f8a25a92",
   "metadata": {},
   "source": [
    "## 查看、修改 数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 424,
   "id": "9b27fae8-7f9f-4111-9c6a-fb0f0d422e2f",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "new_a    object\n",
       "b        object\n",
       "c        object\n",
       "d        object\n",
       "e        object\n",
       "dtype: object"
      ]
     },
     "execution_count": 424,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 462,
   "id": "50c395b4-c064-498c-bf41-1e27fbc8b478",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df = df.convert_dtypes()  # python 推测要转换的类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 466,
   "id": "109b340d-63a7-49e6-b588-46eb2b736878",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0           Wallbridge Mining Company Limited (TSX:WM)\n",
       "1    International Business Machines Corporation (N...\n",
       "2              Lazydays Holdings, Inc. (NasdaqCM:GORV)\n",
       "3          Good Times Restaurants Inc. (NasdaqCM:GTIM)\n",
       "4                 Generation Mining Limited (TSX:GENM)\n",
       "Name: c, dtype: string"
      ]
     },
     "execution_count": 466,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"c\"].astype(\"string\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 468,
   "id": "c7c875fd-4ede-477d-b477-f2fb4db5b92e",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "df[\"c\"] = df[\"c\"].astype(\"string\")  # 将Series中的数据类型更改为float类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 470,
   "id": "a62d354b-3985-4b68-a13c-1fcc14a100da",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "new_a    string[python]\n",
       "b        string[python]\n",
       "c        string[python]\n",
       "d        string[python]\n",
       "e        string[python]\n",
       "dtype: object"
      ]
     },
     "execution_count": 470,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "698e927a-7a21-4dc4-8bb3-0f2a518226ab",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 489,
   "id": "ddb77920-b9d8-4f1b-a237-fc7bc9d5534e",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       b\n",
       "1    <NA>\n",
       "2       b\n",
       "3    <NA>\n",
       "4       b\n",
       "Name: b, dtype: string"
      ]
     },
     "execution_count": 489,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['b'].replace(\"Business Expansions\", 'b')  # 用‘one’代替所有等于1的值   regex=True 是否开启正则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 487,
   "id": "b0bcfdc8-c85a-41ae-9734-1045edcbab44",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    2022-07-26\n",
       "1             O\n",
       "2    2021-10-18\n",
       "3          <NA>\n",
       "4             W\n",
       "Name: new_a, dtype: string"
      ]
     },
     "execution_count": 487,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['new_a'].replace([\"2021-04-12\", \"2021-12-22\"], ['O', 'W'])  # 用'one'代替1，用'three'代替3    # replace 要完全一样"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 493,
   "id": "5d157ca4-7f62-45d7-8015-127bd3e149a7",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    2022-07-26\n",
       "1          2021\n",
       "2          2021\n",
       "3          <NA>\n",
       "4          2021\n",
       "Name: new_a, dtype: string"
      ]
     },
     "execution_count": 493,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['new_a'].replace(\"2021.*\", '2021',regex=True)  #  regex=True 是否开启正则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "51846b7d-7cc3-4d68-9875-c3774f2c5a05",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
